from django.db import models

# Create your models here.


class NyCodeType(models.Model):
    title = models.CharField(max_length=32,verbose_name='类型名称')
    remark = models.TextField(verbose_name='备注',null=True,blank=True)
    utime = models.DateTimeField(auto_now=True,verbose_name='更新时间')
    ctime = models.DateTimeField(auto_now_add=True,verbose_name='创建时间')

    def __str__(self):
        return self.title

class NyCode(models.Model):
    code = models.IntegerField(verbose_name='红包码',help_text='红包码',db_index=True)
    type = models.ForeignKey(to='NyCodeType',on_delete=models.CASCADE,verbose_name='类型')
    remark = models.TextField(verbose_name='备注',null=True,blank=True)
    utime = models.DateTimeField(auto_now=True, verbose_name='更新时间')
    ctime = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
